package com.fengniu.ejb.business;

import java.util.List;
import java.util.Map;

import com.fengniu.ejb.entity.Category;
import com.fengniu.ejb.entity.Content;
import com.fengniu.ejb.entity.DeltaRelation;
import com.fengniu.ejb.entity.Site2Category;
import com.fengniu.ejb.entity.Site2Content;
import com.fengniu.ejb.entity.Site2Site;

public interface ISiteBusiness {

	/**
	 * set store position category,that is add store as member of the category
	 * store will be added as a member of the category only if the category is a
	 * leaf node
	 * 
	 * @param siteSysId
	 * @param id
	 */
	public void setStorePositionCategory(long siteSysId, String categoryId);

	/**
	 * find store position
	 * 
	 * @param siteSysId
	 * @return
	 */
	public Site2Category findStorePositionCategory(long siteSysId);

	/**
	 * get message posted to this site, refer to
	 * <code>IUserBusiness.saveUserPostMessage</code>
	 * 
	 * @param siteSysId
	 * @param pgno
	 * @param pgsize
	 * @return
	 */
	public List<Site2Content> getListSitePostMessage(long siteSysId, int pgno, int pgsize);

	/**
	 * get store sell products page by page
	 * 
	 * @param contentSysId
	 * @param siteSysId
	 * @param siteCategoryId
	 * @param pgno
	 * @param pgsize
	 * @return Map contains List(Site2Content) site2ContentList and Long
	 *         totalCount
	 */
	public Map<String, Object> getStoreSellProducts(long contentSysId, long siteSysId, String siteCategoryId, int pgno,
			int pgsize);

	/**
	 * add recommended store to horde
	 * 
	 * @param hordeSiteSysId
	 * @param storeSiteSysId
	 */
	public Site2Site addHordeRecommendStore(long hordeSiteSysId, long storeSiteSysId);

	/**
	 * 
	 * @param hordeSiteSysId
	 * @param storeSiteSysId
	 * @param pgno
	 * @param pgsize
	 * @return Map contains List(Site2Site) site2SiteList and Long totalCount
	 */
	public Map<String, Object> getHordeRecommendStores(long hordeSiteSysId, long storeSiteSysId, int pgno, int pgsize);

	/**
	 * save user served store coupon
	 * 
	 * @param userSysId
	 * @param servedSiteSysId
	 * @param coupon
	 * @return
	 */
	public Site2Content saveUserServedStoreCoupon(long userSysId, long servedSiteSysId, Content content);

	/**
	 * get primary site category trail, the category id of the trail's top
	 * category is limitedTopCategoryId
	 * 
	 * @param siteSysId
	 * @param initCategoryGroupId
	 * @return
	 */
	public List<Category> getSiteLongestCategoryTrail(long siteSysId, String limitedTopCategoryId);

	/**
	 * get site category trails, the category ids of the trail's top categories
	 * are limitedTopCategoryId
	 * 
	 * @param siteSysId
	 * @param initCategoryGroupId
	 * @return
	 */
	public List<List<Category>> getSiteCategoryTrails(long siteSysId, String limitedTopCategoryId);

	/**
	 * ranking site's membership to category's trail
	 * 
	 * @param siteSysId
	 * @param maxCategoryMember
	 */
	public void rankingSite(long siteSysId, int maxCategoryMember);

	/**
	 * get page sections
	 * 
	 * @param siteSysId
	 * @return Map contains
	 *         topSection,bottomSection,centerSection,leftSection,rightSection
	 */
	public List<Site2Site> getSitePageSections(long siteSysId);

	/**
	 * 
	 * @param siteSysId
	 * @param pageSectionName
	 * @return
	 */
	public Site2Site findSitePageSection(long siteSysId, String pageSectionName);

	/**
	 * 
	 * @param siteSysId
	 * @param sectionName
	 * @param longDesc
	 * @return
	 */
	public Site2Site saveSitePageSection(long siteSysId, String sectionName, String longDesc);

	/**
	 * 
	 * @param hordeSysId
	 * @param site2ContentSysId
	 *            StoreProduct's sysId
	 * @see <code>getHordeRecommendStoreProducts</code>
	 */
	public DeltaRelation addHordeRecommendStoreProduct(long hordeSysId, long site2ContentSysId);

	/**
	 * 
	 * @param hordeSysId
	 * @param site2ContentSysId
	 * 
	 * @see <code>getHordeRecommendStoreCoupons</code>
	 */
	public DeltaRelation addHordeRecommendStoreCoupon(long hordeSysId, long site2ContentSysId);

	/**
	 * 
	 * @param hordeServantUserSysId
	 * @param horde2Store
	 * @return
	 */
	public Site2Site updateHordeRecommendStore(long hordeServantUserSysId, Site2Site horde2Store);

	/**
	 * 
	 * @param hordeServantUserSysId
	 * @param horde2StoreCoupon
	 * @return
	 */
	public DeltaRelation updateHordeRecommendStoreCoupon(long hordeServantUserSysId, DeltaRelation horde2StoreCoupon);

	/**
	 * 
	 * @param hordeServantUserSysId
	 * @param horde2StoreProduct
	 * @return
	 */
	public DeltaRelation updateHordeRecommendStoreProduct(long hordeServantUserSysId, DeltaRelation horde2StoreProduct);

	/**
	 * get horde recommended store's product, every recommended store could have
	 * up to maxCount product
	 * 
	 * @param siteSysId
	 *            hordeSysId
	 * @param site2ContentSysId
	 * @param pgno
	 * @param pgsize
	 * @return Map contains List<DeltaRelation> site2StoreProductList and Long
	 *         totalCount
	 */
	public Map<String, Object> getHordeRecommendStoreProducts(long siteSysId, long site2ContentSysId, int pgno,
			int pgsize);

	/**
	 * get horde recommended store's coupon,every store can only have up-to
	 * couponCountPerStore coupons to be selected
	 * 
	 * @param hordeSiteSysId
	 *            horde sysId
	 * @param site2ContentSysId
	 * @param pgno
	 * @param pgsize
	 * @return Map contains List<DeltaRelation> site2StoreCouponList and Long
	 *         totalCount
	 * 
	 * @see <code>addRecommendStoreCoupon2Horde</code>
	 */
	public Map<String, Object> getHordeRecommendStoreCoupons(long hordeSiteSysId, long site2ContentSysId, int pgno,
			int pgsize);

	/**
	 * add site 2 coupon relation identified by id
	 * 
	 * @param contentSysId
	 * @param storeSiteSysId
	 */
	public Site2Content addStoreSellProduct(long contentSysId, long storeSiteSysId);

	public Site2Content findStoreSellProduct(long contentSysId, long storeSiteSysId);

	/**
	 * 
	 * @param categoryId
	 * @param pgno
	 * @param pgsize
	 * @return
	 */
	public Map getHotWebSites(String categoryId, int pgno, int pgsize);

	public void addSiteAsCategoryMember(long siteSysId, String categoryId);

	public void deleteSiteFromCategoryMember(long siteSysId, String categoryId);
}
